package io.renren.modules.admin.dao;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import io.renren.modules.admin.entity.CourseEntity;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

//com.baomidou.mybatisplus.core.metadata.IPage

/**
 * 课程表
 * 
 * @author chenshun
 * @email sunlightcs@gmail.com
 * @date 2019-12-17 18:24:00
 */
@Mapper
public interface CourseDao extends BaseMapper<CourseEntity> {

    @Select("select a.end_date ,b.course_title,b.course_imgs,b.course_id " +
            "FROM  my_course a INNER JOIN course b ON a.course_id = b.course_id " +
            "WHERE user_id = #{userId}  and a.end_date > now() ORDER BY b.order_num desc")
    // and a.end_date > now()
    List<CourseEntity> getUserCourse(IPage page, Long userId);
	
}
